package cn.webrx;

public class Bank {
	private String name;
	private DataBase db;
	public Bank(String name) {
		this.name=name;
		db=new DataBase();
	}
	//管理员登入
	public boolean adminLogin(Admin admin) {
		return db.selectAdminByLogin(admin);
	}
	//显示所有的用户
	public Customer[] ShowAllCustomer() {
		return db.SelsAllCus();
	}
	//新增用户
	public int addCustomer(Customer c) {
		return db.insertCus(c);
	}
	//删除用户
	public String delCustomrt(String name) {
		return db.delCusByName(name);
	}
	//修改用户
	public int upCustomer(Customer c) {
		return db.updateCustomer(c);
	}
	//用户登入
	public boolean customerLogin(Customer c) {
		return db.selectCustomerByLogin(c);
	}

	//取钱
	public String outMomey(String name,double money) {
		return db.outMoney(name, money);
	}
	//存钱
	public String addMomey(String name,double money) {
		return db.addMoney(name, money);
	}
	//查看余额
	public String showMoney(String name) {
		return db.showCusMoney(name);
	}
	//修改密码
	public String modCusMoney(String name,String password) {
		return db.modCusPass(name, password);
	}
	//显示个人信息
	public String showAllCus(String name) {
		return db.showAllCustomer(name);
	}
	//转账
	public int traniferint(String name,double money,boolean f) {
		return db.transferInt(name, money,f);
	}
	public int traniferout(String name,double money) {
		return db.transferOut(name, money);
	}
	//检查是否存在该用户
	public boolean idName(String name) {
		return db.idName(name);
	}
	@Override
	public String toString() {
		return  name;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public DataBase getDb() {
		return db;
	}
	public void setDb(DataBase db) {
		this.db = db;
	}
}
